package com.project.taohaoCoupons.engine.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class SwaggerConfiguration implements ApplicationRunner {
    @Value("${server.port}")
    private int serverPort;
    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI().info(new Info()
                        .title("牛券-核心引擎系统") // 标题
                        .description("负责优惠券单个查看、列表查看、锁定以及核销等功能等") // 描述 Api 接口文档的基本信息
                        .version("v1.0.0") // 版本
                        .contact(new Contact().name("zhangyuxin").email("1875117028@qq.com"))
                );
    }
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("API Document: http://127.0.0.1:{}/doc.html", serverPort);
    }
}
